
'use strict'

const { Sequelize, DBPool } = require('./mysqldb')

const Role = function() {
  return DBPool.define(
    'role',
    {
      id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
      },
      name: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: ''
      },
      description: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: ''
      },
      routes: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: ''
      }
    },
    {
      tableName: 'role',
      timestamps: true
    }
  )
}

const TableRole = new Role()

module.exports = {
  TableRole
}
